package cc.minos.servers.openfire.ui.textbox
{
	import cc.minos.servers.openfire.chats.ChatMessage;
	import cc.minos.servers.openfire.filters.MessageFilter;
	import cc.minos.servers.openfire.managers.OpenFireManager;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.net.URLRequest;
	import flashx.textLayout.edit.EditManager;
	
	/**
	 * ...
	 * @author Minos
	 */
	public class InputTextFlow extends TextBox implements IInputUI
	{
		
		public function InputTextFlow( width:Number = 100 , height:Number = 15 )
		{
			_manager = new CustomEditManager();
			super( width , height , INPUT );
		}
		
		/* INTERFACE cc.minos.servers.openfire.ui.textbox.interfaces.IInputUI */
		
		public function getMessage():ChatMessage
		{
			var body:String = MessageFilter.changeToSend( _flow );
			var msg:ChatMessage = new ChatMessage( OpenFireManager.connectionManager.connection.jid , body , OpenFireManager.me.nickname );
			return msg;
		}
		
		public function addEmoticon( url:String ):void
		{
			if ( _manager is EditManager )
			{
				( _manager as EditManager ).insertInlineGraphic( url , "auto" , "auto" );
				//( _manager as EditManager ).inserasdtText( "" );a
			}
			setFocus();
		}
		
		private function createGraphic():Shape
        {
            var shape:Shape = new Shape();
            shape.graphics.beginFill( 0x993366 );
            shape.graphics.drawCircle( 5, 4, 6 );
            return shape;
        }
		
		override public function setFocus():void
		{
			super.setFocus();
		}
		
		override public function clearText():void
		{
			setFocus();
			super.clearText();
		}
	
	}

}